package com.briup.pts.config.exception;

import com.briup.pts.config.response.ResultCode;
import lombok.Getter;

/**
 * 自定义的业务逻辑异常类，
 * 专门用于抛出，由于用户操作不当导致的异常
 */
@Getter
public class ServiceException extends RuntimeException {
    private final int code;

    public ServiceException(String message) {
        this(500, message);
    }

    public ServiceException(int code, String message) {
        super(message);
        this.code = code;
    }

    public ServiceException(ResultCode resultCode) {
        this(resultCode.getCode(), resultCode.getMessage());
    }
}
